using Koala.Pro.Common;
using Koala.Pro.Common.Extension;
using System.Globalization;
using System.Windows.Data;

namespace Koala.Pro.Helpers;

internal class OuIdToNameConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value == null)
        {
            return null;
        }
        string text = "";
        if (!value.ToString().IsNullOrEmpty() && !value.ToString().IsNullOrEmpty())
        {
            string[] array = value.ToString().Split(',', StringSplitOptions.RemoveEmptyEntries);
            foreach (string str in array)
            {
                text = text + SecurityHelper.GetOuName(str.ToInt32()) + ",";
            }
        }
        return text.Trim(',');
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
